#include <iostream>
#include <string>
using std::cout;
using std::endl;
using std::string;

class Computer{
public:
    static Computer *get_instance(){
        if(!instance){
            instance =  new Computer("iqoo",4500);
        }
        return instance;
    }

    void destroy(){
        if(instance){
            delete instance;
            instance = nullptr;
        }
    }

    void print(){
    cout<<_brand<<","<<_price<<endl;
    }

    Computer &operator=(const Computer &) = delete;
    Computer (const Computer &) = delete;
private:
    Computer (const string brand,float price)
        :_brand(brand)
         ,_price(price) 
    {}

    ~Computer(){
    }

    static Computer *instance;
    string _brand;
    float _price;

};
 Computer * Computer::instance = nullptr;

void test(){
    Computer *c1 = Computer::get_instance();
    Computer *c2 = Computer::get_instance();
    //computer c3;error
    //computer *c4;error 
    //computer *c5 = c1;error 
    cout<<c1<<":"<<c2<<endl;
    c1->print();
    c2->print();

    c1->destroy();
    c2->destroy();
}

int main()
{


    test ();
    return 0;
}

